package tw.com.softleader.spring.service.impl;

import java.util.List;

import tw.com.softleader.spring.dao.SpringDao;
import tw.com.softleader.spring.service.SpringService;

public class SpringServiceImpl implements SpringService {

	private String greeting; //在spring.xml裡面的bean直接將值inject進來，不過這一定要有setMethod
	
	private List<String> vendors;
	
	private SpringDao springDao;
	
	public void setGreeting(String greeting) {
		this.greeting = greeting;
	}
	
	public void setVendors(List<String> vendors) {
		this.vendors = vendors;
	}
	
	public void setSpringDao(SpringDao springDao) {
		this.springDao = springDao;
	}

	@Override
	public String sayHello(String name) {
		String message = "";
		
		for(String vendor : vendors){
			message += " "+ vendor;
		}
		return greeting +" "+ name+"    "+message;
	}

	@Override
	public List<String> getAllCars() {
		return springDao.getAll();
	}

}
